package com.github.tetrisgame.utils;

import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

import com.github.tetrisgame.R;

import java.util.Random;

public  class Constants {
    //定义每个小方格的尺寸
    public static final int SIZE = UIUtils.dp2px(30);
    public static final int ROW = 20;
    public static final int COLUMN = 10;
    private static Bitmap defaultBitmap;

    //三方平台的应用信息
    public static final String BMOB_API_KEY = "fa5e6c102b2c99467c6033fd6ce088d4";
    public static final String BMOB_APP_ID = "66c2d89c93b73753369115bc2b3b6d6f";

    //获取默认的图片资源位图对象
    public static Bitmap getDefaultBitmap(Context context){
        if (defaultBitmap == null){
            defaultBitmap = BitmapFactory.decodeResource(context.getResources(),R.drawable.blue);
        }
        return defaultBitmap;
    }

    //获取随机的图片资源
    private static int[] images = {R.drawable.blue,R.drawable.yellow,R.drawable.purple,R.drawable.orange,R.drawable.green};
    public static int getRandomImageRes(){
        Random random = new Random();
        int index = random.nextInt(images.length);

        return images[index];
    }
}
